<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var obj = {
      value: 1,
      valueOf() {
        return 2;
      },
      toString() {
        return '3';
      },
      [Symbol.toPrimitive]() {
        return 4;
      },
    };
    console.log(obj + 1); //5
  </script>
</html>
